.class Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;
.super Ljava/lang/Object;
.source "PullRefreshListView.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/netease/newsreader/view/PullRefreshListView;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "FlingRunnable"
.end annotation


# instance fields
.field private mEndRunnable:Ljava/lang/Runnable;

.field private mLastFlingY:I

.field private mScroller:Landroid/widget/Scroller;

.field final synthetic this$0:Lcom/netease/newsreader/view/PullRefreshListView;


# direct methods
.method public constructor <init>(Lcom/netease/newsreader/view/PullRefreshListView;)V
    .locals 2
    .parameter

    .prologue
    .line 653
    iput-object p1, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    .line 651
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 652
    new-instance v0, Landroid/widget/Scroller;

    invoke-virtual {p1}, Lcom/netease/newsreader/view/PullRefreshListView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/widget/Scroller;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mScroller:Landroid/widget/Scroller;

    return-void
.end method

.method static synthetic access$0(Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;)Landroid/widget/Scroller;
    .locals 1
    .parameter

    .prologue
    .line 645
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mScroller:Landroid/widget/Scroller;

    return-object v0
.end method

.method private endFling(ZZ)V
    .locals 2
    .parameter "scrollIntoSlots"
    .parameter "postTask"

    .prologue
    .line 700
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mScroller:Landroid/widget/Scroller;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/Scroller;->forceFinished(Z)V

    .line 702
    if-eqz p2, :cond_0

    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mEndRunnable:Ljava/lang/Runnable;

    if-eqz v0, :cond_0

    .line 703
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    iget-object v1, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mEndRunnable:Ljava/lang/Runnable;

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/view/PullRefreshListView;->post(Ljava/lang/Runnable;)Z

    .line 705
    :cond_0
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mEndRunnable:Ljava/lang/Runnable;

    .line 706
    return-void
.end method

.method private startCommon()V
    .locals 1

    .prologue
    .line 656
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-virtual {v0, p0}, Lcom/netease/newsreader/view/PullRefreshListView;->removeCallbacks(Ljava/lang/Runnable;)Z

    .line 657
    return-void
.end method


# virtual methods
.method public run()V
    .locals 9

    .prologue
    const/4 v8, 0x1

    .line 710
    const/4 v4, 0x0

    .line 712
    .local v4, shouldStopFling:Z
    iget-object v3, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mScroller:Landroid/widget/Scroller;

    .line 713
    .local v3, scroller:Landroid/widget/Scroller;
    invoke-virtual {v3}, Landroid/widget/Scroller;->computeScrollOffset()Z

    move-result v1

    .line 714
    .local v1, more:Z
    invoke-virtual {v3}, Landroid/widget/Scroller;->getCurrY()I

    move-result v6

    .line 716
    .local v6, y:I
    iget v7, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mLastFlingY:I

    sub-int v0, v7, v6

    .line 717
    .local v0, delta:I
    iget-object v7, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-static {v7, v0}, Lcom/netease/newsreader/view/PullRefreshListView;->access$5(Lcom/netease/newsreader/view/PullRefreshListView;I)V

    .line 719
    iget-object v7, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-virtual {v7}, Lcom/netease/newsreader/view/PullRefreshListView;->getScrollY()I

    move-result v2

    .line 720
    .local v2, scrollY:I
    const/4 v5, 0x0

    .line 722
    .local v5, targetscrollY:I
    if-ne v2, v5, :cond_0

    .line 723
    const/4 v4, 0x1

    .line 726
    :cond_0
    if-eqz v1, :cond_1

    if-nez v4, :cond_1

    .line 727
    iput v6, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mLastFlingY:I

    .line 728
    iget-object v7, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-virtual {v7, p0}, Lcom/netease/newsreader/view/PullRefreshListView;->post(Ljava/lang/Runnable;)Z

    .line 732
    :goto_0
    return-void

    .line 730
    :cond_1
    invoke-direct {p0, v8, v8}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->endFling(ZZ)V

    goto :goto_0
.end method

.method public startUsingDistance(I)V
    .locals 2
    .parameter "distance"

    .prologue
    .line 691
    const/4 v0, 0x0

    const/4 v1, 0x0

    invoke-virtual {p0, p1, v0, v1}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->startUsingDistance(ILjava/lang/Runnable;Z)V

    .line 692
    return-void
.end method

.method public startUsingDistance(ILjava/lang/Runnable;Z)V
    .locals 6
    .parameter "distance"
    .parameter "task"
    .parameter "postLastTask"

    .prologue
    const/4 v0, 0x1

    const/4 v1, 0x0

    .line 674
    invoke-direct {p0, v0, p3}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->endFling(ZZ)V

    .line 676
    iput-object p2, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mEndRunnable:Ljava/lang/Runnable;

    .line 678
    if-nez p1, :cond_0

    .line 679
    invoke-direct {p0, v0, v0}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->endFling(ZZ)V

    .line 688
    :goto_0
    return-void

    .line 683
    :cond_0
    invoke-direct {p0}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->startCommon()V

    .line 685
    iput v1, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mLastFlingY:I

    .line 686
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->mScroller:Landroid/widget/Scroller;

    neg-int v4, p1

    iget-object v2, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-static {v2}, Lcom/netease/newsreader/view/PullRefreshListView;->access$4(Lcom/netease/newsreader/view/PullRefreshListView;)I

    move-result v5

    move v2, v1

    move v3, v1

    invoke-virtual/range {v0 .. v5}, Landroid/widget/Scroller;->startScroll(IIIII)V

    .line 687
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-virtual {v0, p0}, Lcom/netease/newsreader/view/PullRefreshListView;->post(Ljava/lang/Runnable;)Z

    goto :goto_0
.end method

.method public stop(ZZ)V
    .locals 1
    .parameter "scrollIntoSlots"
    .parameter "postTask"

    .prologue
    .line 695
    iget-object v0, p0, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->this$0:Lcom/netease/newsreader/view/PullRefreshListView;

    invoke-virtual {v0, p0}, Lcom/netease/newsreader/view/PullRefreshListView;->removeCallbacks(Ljava/lang/Runnable;)Z

    .line 696
    invoke-direct {p0, p1, p2}, Lcom/netease/newsreader/view/PullRefreshListView$FlingRunnable;->endFling(ZZ)V

    .line 697
    return-void
.end method
